/**************************************************************************(C)*
 *
 *  This file is part of the GreenHills project
 *  Copyright (C) 2009  Tieto Corporation
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  Not for commmercial use. Only with Tieto permission.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************(C)*/
#pragma once
#include <QObject>
#include "utildll.h"

namespace greenhills {
namespace util {
/**
  * @brief timerbox widget is non visual component, that can be used where circle
  * and movement around it is needed according to center angle.
  *
  */
    class GH_UTIL_QT_CLASS CTimerBox : public QObject
    {
        Q_OBJECT

    public:
        CTimerBox(QObject *parent);
        void setStep(float pStep);        

    private:
        int mTimer;
        bool mFlag;
        float mCurrentValue;
        float mStep;
        float mCurrentStep;        
        float mNewValue;
/**
  * @brief is invoked every 20 ms. This method increments the mCurrentValue
  * with mCurrentStep. When the mNewValue is reached mTimer is stopped and
  * step is set to 0.0 value.
  */
        virtual void timerEvent(QTimerEvent * pEvent);
/**
  * @brief method sets the direction of rotation. Its invoked in onValueChange
  * method
  */
        void rotation(float pNew, float pCurrent);

    signals:
/**
  * @brief signal emited by onValueChange method if needed.
  */
        void timerRepeater(float pVal);
        void timerRepeater(int pVal);

    public slots:
/**
  * @brief sets the mNewValue and starts QTimerEvent everytime is needed
  */
         void onValueChange(float pVal);
         void onValueChange(int pVal);
    };
} //namespace util
} //namespace greenhills
